package com.damon.authority.dal.entity;

import com.kylin.shared.common.entity.BaseEntry;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 权限系统中的资源数据项
 * @author Damon S.
 * @version v1.0.1
 * @date 2019年11月01日 10:57
 */
@Entity
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table(name = "t_platform_resource", catalog = "db_kylin_artwork")
public final class ResourceEntry extends BaseEntry implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true)
    private Long resourceId;

    /** 编码：有规律的自定义编码，有层级关系。R1001,R100101,R100102…… */
    @Column(length = 16)
    private String code;

    /** 取一个用于显示的名字 */
    @Column(length = 32)
    private String name;

    /** 资源路径：页面路径用斜杠（根页面取值斜杠/） */
    @Column(length = 256)
    private String path;

    /** 区分不同系统 */
    @Column(length = 16)
    private String catalog;

    /** 资源排序，越大越靠前 */
    @Column private Integer order;

    /** 标明资源类型：页面，功能，数据等 */
    @Column(columnDefinition = "TINYINT")
    private Integer type;

    /** 资源状态：正常，冻结 */
    @Column(columnDefinition = "TINYINT")
    private Integer state;

    /** 该资源允许的操作集合 */
    @Column(length = 32)
    private String operation;

    /** 父级资源：根资源取值0 */
    @Column(name = "parent_id")
    private Integer parentId;
}
